package com.orgcent.activities.ainma;

import com.orgcent.activities.R;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

/**
 * 用于Activity间切换动画
 */
public class BActivity extends Activity {
	Bundle extras;

	public void onCreate(Bundle saveInstanceState) {
		super.onCreate(saveInstanceState);
		setContentView(R.layout.anima_layout_b);
		setTitle("BActivity");
		// Window w = this.getWindow();
		// overridePendingTransition(R.anim.push_left_in,R.anim.push_left_in);
		extras = getIntent().getExtras();
		if (extras != null) {
			String animation = extras.getString("animation");
			if (animation != null && animation.equals("back")) {
				overridePendingTransition(R.anim.push_left_in, R.anim.push_out);
				// w.setWindowAnimations(R.anim.push_left_out);
			} else {

				// w.setWindowAnimations(R.anim.push_left_in);
				overridePendingTransition(R.anim.push_right_in, R.anim.push_out);
			}
		} else {
			overridePendingTransition(R.anim.push_right_in, R.anim.push_out);
		}

		Button preButton = (Button) findViewById(R.id.prebutton);
		// nextItem
		preButton.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				Intent intent = new Intent(BActivity.this, AActivity.class);

				intent.putExtra("animation", "back");
				startActivity(intent);
			}

		});

	}

}
